package com.boarsoft.boar.code.svc.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.boarsoft.bean.ReplyInfo;
import com.boarsoft.boar.code.entity.MethodInfo;
import com.boarsoft.boar.code.svc.biz.MethodInfoBiz;
import com.boarsoft.common.dao.PagedResult;

@RestController
@RequestMapping(value = "/face/method")
public class FaceMethodAction {
	@Autowired
	private MethodInfoBiz methodInfoBiz;

	/**
	 * 方法列表查询：/code/face/method/list.do 根据接口查接口下的方法信息
	 * 
	 * @param faceId
	 *            接口id
	 * @return 方法信息列表
	 */
	@RequestMapping(value = "/list.do")
	// @Authorized(code = "com.list")
	public ReplyInfo<Object> list(@RequestParam("faceId") String faceId, String key, int pageNo, int pageSize) {
		PagedResult<MethodInfo> pr = methodInfoBiz.list(faceId, key, pageNo, pageSize);
		return new ReplyInfo<Object>(true, pr);
	}

	/**
	 * bean列表查询：/code/bean/info/list.do
	 *
	 * @param faceId
	 *            接口id
	 * @return SUCCESS
	 */
	@RequestMapping(value = "/delete.do")
	// @Authorized(code = "com.list")
	public ReplyInfo<Object> delete(@RequestParam String faceId) {
		methodInfoBiz.delete(faceId);
		return ReplyInfo.SUCCESS;
	}
}
